
function DateUtils(){
	
}

/**
 *获得当前日期和时间，形式为： 2014-4-2 3:5
 */
DateUtils.getCurrentDate=function(){
	var today=new Date;
	//获得日期
	var year=today.getFullYear();
	var month=today.getMonth()+1;
	var day=today.getDate();
	//获得时间
	var hour=today.getHours();
	var minute=today.getMinutes();
	var second=today.getSeconds();
	var currentDate=year+'-'+month+'-'+day;
	var currentTime=hour+':'+minute+':'+second;
	//将日期和时间组装成2014-04-02 13:53
	var curentDateTime=currentDate+' '+currentTime;
	return curentDateTime;
}

/**
 *获得当前完整日期和时间，形式为： 2014-04-02 13:53
 */
DateUtils.getFullCurrentDate=function(){
	var today=new Date;
	//获得日期
	var year=today.getFullYear();
	var month=today.getMonth()+1;
	var day=today.getDate();
	//获得时间
	var hour=today.getHours();
	var minute=today.getMinutes();
	var second=today.getSeconds();
	
	//月份和天数单位数时加0
	if(month<10){
		month='0'+month;
	}
	if(day<10){
		day='0'+day;
	}
	//时间单位数时加0
	if(hour<10){
		hour='0'+hour;
	}
	if(minute<10){
		minute='0'+minute;
	}
	if(second<10){
		second='0'+second;
	}
	var currentDate=year+'-'+month+'-'+day;
	var currentTime=hour+':'+minute+':'+second;
	//将日期和时间组装成2014-04-02 13:53
	var curentDateTime=currentDate+' '+currentTime;
	return curentDateTime;
}

/**
 *获得当前完整日期和时间，形式为： 2014-04-02 星期一 13:53
 */
DateUtils.getFullCurrentDate2=function(){
	var today=new Date;
	//获得日期
	var year=today.getFullYear();
	var month=today.getMonth()+1;
	var day=today.getDate();
	//获得时间
	var hour=today.getHours();
	var minute=today.getMinutes();
	var second=today.getSeconds();
	
	//月份和天数单位数时加0
	if(month<10){
		month='0'+month;
	}
	if(day<10){
		day='0'+day;
	}
	//时间单位数时加0
	if(hour<10){
		hour='0'+hour;
	}
	if(minute<10){
		minute='0'+minute;
	}
	if(second<10){
		second='0'+second;
	}
	var currentDate=year+'-'+month+'-'+day;
	var currentTime=hour+':'+minute+':'+second;
	var weekIndex=today.getDay();
	var week='';
	if(weekIndex==0){
		week="星期日";
	}else if(weekIndex==1){
		week="星期一";
	}else if(weekIndex==2){
		week="星期二";
	}else if(weekIndex==3){
		week="星期三";
	}else if(weekIndex==4){
		week="星期四";
	}else if(weekIndex==5){
		week="星期五";
	}else if(weekIndex==6){
		week="星期六";
	}
	//将日期和时间组装成2014-04-02 13:53
	var curentDateTime=currentDate+' '+week+' '+currentTime;
	return curentDateTime;
}

/**
 *动态显示时间 
 * @param {Object} $div
 */
DateUtils.setDate=function($div){
	setInterval(callBack,1000 );
	function callBack(){
		$div.text(DateUtils.getFullCurrentDate2());
	}
	
}

